<template>
	<view class="contina">
		<view class="w" style="height: calc(100% - 20rpx);">
			<scroll-view scroll-y class="scrollView" v-if="list.length > 0" @scrolltolower="getList">
				<template v-for="(item,idx) in list">
					<view class="date">{{$dayjs(item.created_at).format('YYYY-MM')}}</view>
					<view class="card" @click="toPath(item.id)">
						<view class="top flex_a_c">
							<view class="left flex_a_c">
								<view class="tag">数电发票</view>
								<view class="time">{{item.created_at}}</view>
							</view>
							<view class="right2" v-if="item.status">已开票</view>
							<view class="right" v-else>待开票</view>
						</view>
						<view class="cent">{{item.order_id?item.order_id.length:0}}条订单记录</view>
						<view class="bom flex_a_c">
							<view>合计金额</view>
							<view class="price">¥<text class="num">{{item.amount}}</text></view>
						</view>
					</view>
				</template>
			</scroll-view>
			<view class="no" v-else>
				<image src="../../static/image/none.png"></image>
				<view class="em">暂无数据</view>
			</view>
		</view>
	</view>
</template>

<script>
	import searchCom from "@/compoment/searchCom.vue";
	import flooterCom from "@/compoment/flooterCom.vue"
	export default {
		data() {
			return {
				list: [],
				page: 1,
			}
		},
		components: {
			searchCom,
			flooterCom
		},
		onShow() {
			this.getList()
		},
		onHide() {
			this.page = 1
			this.list = []
		},
		methods: {
			toAdd() {
				uni.navigateTo({
					url: "/pagesB/invoice/invoice"
				})
			},
			toPath(id) {
				uni.navigateTo({
					url: "/pagesB/invoiceDetil/invoiceDetil?id=" + id
				})
			},
			async getList() {
				let res = await this.$api.corpPayInvoiceApi.list({
					page: this.page,
				})
				if (res.list.length) {
					this.list = this.list.concat(res.list)
					this.page++
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.contina {
		height: 100%;

		.seach {
			padding: 20rpx 30rpx;
			background-color: #fff;
			box-sizing: border-box;

			.tabs {
				justify-content: space-between;
				align-items: center;
				font-size: 26rpx;
				font-weight: 400;
				color: #3D3D3D;
				margin-top: 30rpx;
			}
		}

		.scrollView {
			height: 100%;

			.date {
				margin: 30rpx 0 20rpx 0;
			}

			.card {
				padding: 30rpx;
				box-sizing: border-box;
				position: relative;


				.top {
					justify-content: space-between;
					padding-bottom: 30rpx;
					border-bottom: 1px solid #D8D8D8;

					.left {
						.tag {
							width: 116rpx;
							height: 30rpx;
							background: #D4D9F4;
							font-size: 24rpx;
							font-weight: 400;
							color: #0074FF;
							line-height: 30rpx;
							text-align: center;
						}

						.time {
							font-size: 28rpx;
							font-weight: 400;
							color: #000000;
							margin-left: 10rpx;
						}
					}

					.right {
						font-size: 28rpx;
						font-weight: 400;
						color: #DF9E5C;
					}
					.right2 {
						font-size: 28rpx;
						font-weight: 400;
						color: #0074FF;
					}
				}

				.cent {
					font-size: 28rpx;
					font-weight: 400;
					color: #888888;
					margin-top: 30rpx;
				}

				.bom {
					font-size: 28rpx;
					font-weight: 400;
					color: #888888;
					margin-top: 30rpx;
					justify-content: space-between;

					.price {
						font-size: 28rpx;
						font-weight: 400;
						color: #888888;
					}

					.num {
						color: #000000;
						font-size: 36rpx;
					}
				}
			}
		}

		image {
			width: 412rpx;
			height: 284rpx;
			border-radius: 0px 0px 0px 0px;
		}

		.no {
			margin-top: 50rpx;
			display: flex;
			justify-content: center;
			flex-direction: column;
			align-items: center;
			margin-top: 332rpx;

			.em {
				width: 128rpx;
				height: 50rpx;
				font-size: 32rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				color: #888888;
			}
		}


	}
</style>